/**
 * 文件名：LogisticsActualCostController.java
 *
 * 创建人：Fyh - 1009173473@qq.com
 *
 * 创建时间：2020年4月2日 下午5:06:04
 *
 * 版权所有：南京植百汇智能科技服务有限公司
 */
package com.z100h.supplychain.evidence.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.web.BaseController;
import com.z100h.supplychain.evidence.entity.LogisticsActualCost;
import com.z100h.supplychain.evidence.entity.LogisticsActualCostVo;
import com.z100h.supplychain.evidence.facade.LogisticsActualCostFacade;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * [描述信息：说明类的基本功能]
 *
 * @author Fyh - 1009173473@qq.com
 * @version 1.0 Created on 2020年4月2日 下午5:06:04
 */
@Controller
@RequestMapping(value = "${adminPath}/sc/logisticsActualCost")
public class LogisticsActualCostController extends BaseController {

	@Autowired
	private LogisticsActualCostFacade logisticsActualCostFacade;

	@ApiOperation(value = "物流实际成本列表", notes = "findByPage", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ResponseBody
	@RequestMapping(value = "findByPage")
	public Map<String, Object> findByPage(Page<LogisticsActualCostVo> page, LogisticsActualCostVo logisticsActualCostVo,
			HttpServletRequest request, HttpServletResponse response) {
		logisticsActualCostVo.setPage(page);
		page = logisticsActualCostFacade.findByPage(page, logisticsActualCostVo);
		return getBootstrapData(page);
	}

	@ApiOperation(value = "物流实际成本保存", notes = "save", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ResponseBody
	@RequestMapping(value = "save")
	public String save(HttpServletRequest request, @RequestBody LogisticsActualCost logisticsActualCost) {
		try {
			logisticsActualCostFacade.save(logisticsActualCost);
			return "1";
		} catch (Exception e) {
			e.printStackTrace();
			return "0";
		}

	}

	@ApiOperation(value = "物流实际成本详情", notes = "findById", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "id", value = "主键id", required = true, paramType = "query", dataType = "string", defaultValue = "78") })
	@ResponseBody
	@RequestMapping(value = "findById")
	public LogisticsActualCostVo findById(String id, HttpServletRequest request, HttpServletResponse response) {
		return logisticsActualCostFacade.findById(id);
	}

	@ApiOperation(value = "物流实际成本删除", notes = "delete", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "id", value = "主键id", required = true, paramType = "query", dataType = "string", defaultValue = "79") })
	@ResponseBody
	@RequestMapping(value = "delete")
	public String save(HttpServletRequest request, String id) {
		try {
			logisticsActualCostFacade.delete(id);
			return "1";
		} catch (Exception e) {
			e.printStackTrace();
			return "0";
		}

	}
}
